package com.hu.web.servlet;

import javax.servlet.*;
import java.io.IOException;

public class FirstServlet extends GenericServlet {

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("FirstServlet 的 service 方法执行");

        ServletContext servletContext = servletRequest.getServletContext();
        System.out.println("servletContext: " + servletContext);

        // 向 ServletContext 作用域对象中设置共享数据
        servletContext.setAttribute("msg","FirstServlet 设置的共享数据");
    }

}
